<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

<div th:replace="include/header::head"></div>

<div th:replace="include/teacher_navbar::navbar(${loginTeacher})"></div>

<div class="container">
	<h1>
		<img th:src="@{/static/img/exam-teacher.png}" /> 上机考试管理
	</h1>
	<div class="exam-form form-inline">
		<h4>添加考试</h4>
		<input type="text" id="examName" name="ename" placeholder="考试名称*" size="20" />
		<div class="controls input-append date" id="datetimepicker" data-link-field="etime" >
			<input class="span2" size="16" type="text"  placeholder="考试时间*" readonly/>
			<span class="add-on"><i class="icon-remove"></i></span>
			<span class="add-on"><i class="icon-th"></i></span>
		</div>
		<input type="hidden" id="etime" name="etime" />
		<input type="checkbox" id="isAutoStart" name="eautostart" value="true"/> 自动开始&nbsp;
		<button id="addExam" class="btn btn-primary">添加</button>
	</div>

	<table class="table table-striped table-bordered">
		<thead>
		<tr>
			<th class="span3">考试名称</th>
			<th class="span3">考试时间</th>
			<th>创建人</th>
			<th>上传试卷</th>
			<th>自动开始</th>
			<th>进行中</th>
			<th>已结束</th>
			<th>已归档</th>
			<th>已清理</th>
			<th>&nbsp;</th>
		</tr>
		</thead>
		<tbody>
		<tr th:each="e : ${examList}">
			<td th:text="${e.name}"></td>
			<td th:text="${#dates.format(e.time, 'yyyy-MM-dd HH:mm:ss')}"></td>
			<td th:text="${e.teacherName}"></td>
			<td>
				<i class="icon-ok" th:if="${e.paper!=null and !e.paper.equals('')}"></i>
			</td>
			<td>
				<i class="icon-ok" th:if="${e.isAutostart != null and e.isAutostart}"></i>
			</td>
			<td>
				<i class="icon-ok" th:if="${e.isActive != null and e.isActive}"></i>
			</td>
			<td>
				<i class="icon-ok" th:if="${e.isFinish != null and e.isFinish}"></i>
			</td>
			<td>
				<i class="icon-ok" th:if="${e.isArchived != null and e.isArchived}"></i>
			</td>
			<td>
				<i class="icon-ok" th:if="${e.isCleared != null and e.isCleared}"></i>
			</td>
			<td>
				<a class="btn" title="编辑"
				   th:href="@{'/teacher/exam/modify/' + ${e.id}}" th:if="${(e.isActive==null or !e.isActive) and (e.isFinish==null or !e.isFinish)}">
					<i class="icon-edit"></i>
				</a>
			</td>
		</tr>
		</tbody>
	</table>
</div>


<div th:replace="include/teacher_footer::footer"></div>
<script type="text/javascript">
$("#datetimepicker").datetimepicker({
    format: "yyyy-mm-dd hh:ii",
    autoclose: true,
    todayBtn: true,
    minuteStep: 10,
    minView:0,
    pickerPosition:'bottom-left',
    language:'zh-CN'
});
</script>
